<?php
namespace Home\Controller;
use Think\Controller;
use Think\Page;
class BaseController extends Controller {
    
    public function _initialize(){
        $this->assign('self',__SELF__);
        $this->assign('action',ACTION_NAME);
        $this->assign('nav',$this->nav());
    }
    
    
    /**
     * 网站一级导航
     *
     * date:2017年9月15日
     * author: EK_熊
     */
    public function nav(){
        $map = [
            'status'=>1,
            'parent'=>0,
            'is_nav'=>1,
        ];
        $nav = M('terms')->where($map)->field('term_id,name,url')->order('listorder')->limit(6)->select();
        return $nav;
        
    }
    
    public function getbanner(){
        $tid = I('tid');
        $lang = I('lang');
        $data = banner($tid, $lang);
        $this->ajaxReturn($data);
    }
    
    
    /**
     * 设置访问语言版本
     * 
     * date:2017年10月14日
     * author: EK_熊
     */
    public function  setlang(){
        $lang = I('lang');
        $key = 'web_lang';
        $cookie = cookie($key,$lang);
        if (cookie($key)) {
            $this->success('设置成功');
        }else{
            $this->error('设置失败');
        }
    }
    
}